Skip to content

ROSAENG-1331: Add VpcEndpointTemplate MC e2e tests - #463

Open
dustman9000 wants to merge 1 commit into
openshift:mainfrom
dustman9000:avo-mc-e2e
Open

ROSAENG-1331: Add VpcEndpointTemplate MC e2e tests#463
dustman9000 wants to merge 1 commit into
openshift:mainfrom
dustman9000:avo-mc-e2e

Conversation

@dustman9000

@dustman9000 dustman9000 commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • Add e2e tests for the VpcEndpointTemplate controller on real Management Clusters
  • Tests create a fake HCP, verify AVO creates a VpcEndpoint from the private-hcp template with correct labels, then verify cleanup when the HCP is deleted
  • Auto-skips on non-MC clusters where the VpcEndpointTemplate CR doesn't exist

This enables the rosa-hcp-mc-e2e Prow job in openshift/release#82850 to actually test AVO's MC-specific controller behavior rather than just CEL validation.

Jira: https://redhat.atlassian.net/browse/ROSAENG-1331

Test plan

Summary by CodeRabbit

  • Tests
    • Added end-to-end coverage for VPC endpoint template management.
    • Validates hosted control plane creation, endpoint templating, required labels, and cleanup after deletion.
    • Added automated handling for test resource cleanup.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 4, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 4, 2026

Copy link
Copy Markdown

@dustman9000: This pull request references ROSAENG-1331 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Summary

  • Add e2e tests for the VpcEndpointTemplate controller on real Management Clusters
  • Tests create a fake HCP, verify AVO creates a VpcEndpoint from the private-hcp template with correct labels, then verify cleanup when the HCP is deleted
  • Auto-skips on non-MC clusters where the VpcEndpointTemplate CR doesn't exist

This enables the rosa-hcp-mc-e2e Prow job in openshift/release#82850 to actually test AVO's MC-specific controller behavior rather than just CEL validation.

Jira: https://redhat.atlassian.net/browse/ROSAENG-1331

Test plan

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
openshift-ci Bot requested review from BATMAN-JD and reedcort August 4, 2026 23:46
@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dustman9000

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 161eae02-1007-448d-8d1b-328bb60eb7a7

📥 Commits

Reviewing files that changed from the base of the PR and between 6af00e6 and 91e5f06.

📒 Files selected for processing (1)
  • test/e2e/vpcendpointtemplate_mc_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/e2e/vpcendpointtemplate_mc_test.go

Walkthrough

Changes

VpcEndpointTemplate end-to-end test

Layer / File(s) Summary
Test setup and HostedControlPlane fixture
test/e2e/vpcendpointtemplate_mc_test.go
The OSDE2E suite registers the HyperShift API scheme, checks for the expected template, and builds AWS HostedControlPlane resources.
VpcEndpoint lifecycle validation
test/e2e/vpcendpointtemplate_mc_test.go
The test creates a HostedControlPlane, verifies the templated VpcEndpoint and labels, then confirms cleanup after deletion.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: reedcort, batman-jd

🚥 Pre-merge checks | ✅ 12 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Microshift Test Compatibility ⚠️ Warning The untagged Describe uses avo.openshift.io VpcEndpoint resources and hypershift.openshift.io HostedControlPlane, with no MicroShift label, apigroup tag, or IsMicroShiftCluster guard. Add [Skipped:MicroShift] or apigroup tags for avo.openshift.io and hypershift.openshift.io, or call IsMicroShiftCluster() and g.Skip() before the test runs.
Test Structure And Quality ❓ Inconclusive Investigation is still in progress; the test structure and repository patterns require comparison before assessment. Inspect neighboring e2e suites and controller fixture requirements before deciding.
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the addition of VpcEndpointTemplate management-cluster end-to-end tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed All Describe and It titles in the added suite are static; generated cluster, HCP, and namespace values appear only in test setup, By steps, or messages.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The added Ginkgo tests create and delete an HCP and verify VpcEndpoint resources; they use no node APIs, replica/HA settings, scheduling constraints, failover, scaling, or multi-endpoint assumptions.
Topology-Aware Scheduling Compatibility ✅ Passed The PR adds only an osde2e test and an HCP fixture. It adds no Deployment, Pod, affinity, topology spread, node selector, toleration, replica, or PDB scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The new test has no fmt.Print, log.Print, klog, os.Stdout, or other direct stdout writes; its GinkgoLogr calls run in Ginkgo hooks/tests.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new Ginkgo test uses only Kubernetes API operations and cluster-internal kubernetes.default.svc; it contains no IPv4 literals, IP parsing, IPv4 CIDRs, public URL access, or DNS/API calls.
No-Weak-Crypto ✅ Passed The added Go e2e test uses Kubernetes clients, formatting, timing, and resource definitions only; it contains no weak algorithms, crypto APIs, custom crypto, or secret comparisons.
Container-Privileges ✅ Passed The PR adds only a Go e2e test; scans found no privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, root, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed Added logs contain a fixed template type, generated test names, and template labels; no passwords, tokens, keys, PII, or constructed hostname is logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
test/e2e/vpcendpointtemplate_mc_test.go (2)

31-31: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add a stable Context node for the lifecycle scenario.

The two It nodes are direct children of Describe. Wrap the VpcEndpoint lifecycle tests in a stable Context, such as Context("when a HostedControlPlane uses the private-hcp template", ...).

As per coding guidelines, **/*_test.go must “use Ginkgo/Gomega with Describe, Context, and It for BDD-style tests.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/vpcendpointtemplate_mc_test.go` at line 31, Wrap the lifecycle test
cases inside the top-level Describe block in a stable Context describing the
private-HCP template scenario, such as “when a HostedControlPlane uses the
private-hcp template.” Keep both existing It nodes within that Context and
preserve their test behavior.

Source: Coding guidelines


62-62: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add operation-specific assertion messages.

These assertions do not identify the failed Kubernetes operation. Add messages for Namespace creation, HostedControlPlane retrieval, and HostedControlPlane deletion.

As per coding guidelines, “assertions should include meaningful failure messages.”

Also applies to: 102-104

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/e2e/vpcendpointtemplate_mc_test.go` at line 62, Add operation-specific
failure messages to the assertions in the namespace creation and
HostedControlPlane retrieval/deletion flows, including the Expect call around
c.Create(ctx, ns) and the related assertions near the referenced lines. Identify
each Kubernetes operation clearly as Namespace creation, HostedControlPlane
retrieval, or HostedControlPlane deletion while preserving the existing
assertion conditions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/e2e/vpcendpointtemplate_mc_test.go`:
- Around line 63-72: The cleanup registered around the HostedControlPlane and
namespace in the first It must not run before the second ordered spec verifies
VpcEndpoint deletion. Move both cleanup operations to AfterAll (or combine the
checks into one It) and assert or otherwise handle errors returned by c.Delete
instead of discarding them.

---

Nitpick comments:
In `@test/e2e/vpcendpointtemplate_mc_test.go`:
- Line 31: Wrap the lifecycle test cases inside the top-level Describe block in
a stable Context describing the private-HCP template scenario, such as “when a
HostedControlPlane uses the private-hcp template.” Keep both existing It nodes
within that Context and preserve their test behavior.
- Line 62: Add operation-specific failure messages to the assertions in the
namespace creation and HostedControlPlane retrieval/deletion flows, including
the Expect call around c.Create(ctx, ns) and the related assertions near the
referenced lines. Identify each Kubernetes operation clearly as Namespace
creation, HostedControlPlane retrieval, or HostedControlPlane deletion while
preserving the existing assertion conditions.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: e106477b-ec09-4327-8a26-07987c82c5bb

📥 Commits

Reviewing files that changed from the base of the PR and between 1b26921 and e363f26.

📒 Files selected for processing (1)
  • test/e2e/vpcendpointtemplate_mc_test.go

Comment thread test/e2e/vpcendpointtemplate_mc_test.go Outdated
@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.04%. Comparing base (1b26921) to head (91e5f06).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #463   +/-   ##
=======================================
  Coverage   45.04%   45.04%           
=======================================
  Files          32       32           
  Lines        2360     2360           
=======================================
  Hits         1063     1063           
  Misses       1175     1175           
  Partials      122      122           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@redhat-chai-bot

Copy link
Copy Markdown
Collaborator

/lgtm


AI-generated. Review for accuracy.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 6af00e6 and 2 for PR HEAD d94498b in total

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2026
@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@dustman9000

Copy link
Copy Markdown
Member Author

/retest ci/prow/validate

@dustman9000

Copy link
Copy Markdown
Member Author

/retest

Test the VpcEndpointTemplate controller on real Management Clusters.
Creates a fake HCP in a test namespace, verifies AVO creates a
VpcEndpoint from the private-hcp template, then verifies cleanup
when the HCP is deleted. Skips on non-MC clusters where the
VpcEndpointTemplate CR does not exist.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@dustman9000

Copy link
Copy Markdown
Member Author

/retest ci/prow/validate

@dustman9000

Copy link
Copy Markdown
Member Author

/retest

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@dustman9000: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/validate 91e5f06 link true /test validate

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants